var t = getApp()
Page({
  data: {
    change:0,
    score:0,
    in_list:[],
    out_list:[],
    navHeight:t.globalData.navHeight,
    title:'我的积分',
    // get_list:[{
    //   item:'洗车消费10元获得',
    //   time:'2021.02.10 12:30:23',
    //   num:'+10'
    // },{
    //   item:'洗车消费10元获得',
    //   time:'2021.02.10 12:30:23',
    //   num:'+10'
    // },{
    //   item:'洗车消费10元获得',
    //   time:'2021.02.10 12:30:23',
    //   num:'+10'
    // },{
    //   item:'洗车消费10元获得',
    //   time:'2021.02.10 12:30:23',
    //   num:'+10'
    // }]
  },
  onLoad: function (options) {
    console.log(options);
    this.setData({
      score:options.score
    })
    this.get_log()
  },
  onRefresh(){
    //在当前页面显示导航条加载动画
    wx.showNavigationBarLoading(); 
    //显示 loading 提示框。需主动调用 wx.hideLoading 才能关闭提示框
    this.get_log()
  },
  onPullDownRefresh: function () {
    //调用刷新时将执行的方法
    this.onRefresh();
    setTimeout(function () {
      // 不加这个方法真机下拉会一直处于刷新状态，无法复位
      wx.stopPullDownRefresh()
    }, 1000)
  },
  get_log(e){
    var that = this
    t.request('/users/socre_log',{},function(e){
      console.log(e);
      if (e.code==200) {
        var in_list = e.result.in
        var out_list = e.result.out
        that.setData({
          in_list:in_list,
          out_list:out_list
        })
      }
    })
  },
  change_nav(e){
    this.setData({
      change:e.currentTarget.dataset.index
    })
  },
  navigate(e){
    var url 
    switch (e.currentTarget.dataset.page) {
      case 'exchange':
        wx.switchTab({
          url: '/pages/pointMall/pointMall',
        })
        break;
    
      default:
        break;
    }
  }
})